package com.maiji.cloud.response.shopingmall;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.maiji.cloud.entities.shopingmall.GoodsComment;
import com.maiji.cloud.response.login.UploadImageResData;
import com.maiji.cloud.utils.ShareInfoEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;

@NoArgsConstructor
@Data
@Accessors(chain=true)
public class GoodsResData {

    @ApiModelProperty(value="商品主键")
    private String uuId; //主键

    @ApiModelProperty(value="商品名称")
    private String name;

    @ApiModelProperty(value="配送费")
    private Double deliveryFee;  //

    @ApiModelProperty(value="商品简称")
    private String shortName;
   
    @ApiModelProperty(value="商品详情")
    private String detailText;

    @ApiModelProperty(value="净含量(克)")
    private Integer netWeight;

    @ApiModelProperty(value="总重量(克)")
    private Integer weight;

    @ApiModelProperty(value="商品原价格")
    private Double originalPrice;

    @ApiModelProperty(value="商品现价格")
    private Double presentPrice;

    @ApiModelProperty(value="库存")
    private Integer stockVolume;

    @ApiModelProperty(value="销售量")
    private Integer salesVolume;

    @ApiModelProperty(value="收藏数")
    private Integer collectionVolume;

    @ApiModelProperty(value="评论数")
    private Integer commentVolume;

    @ApiModelProperty(value="未审核评论数")
    private Integer commentCount;
    
    @ApiModelProperty(value="提示")
    private String hint; 
    
    @ApiModelProperty(value="购物须知")
    private String notice;

    @ApiModelProperty(value="是否可积分兑换：1是，0否")
    private Integer isExchange;

    @ApiModelProperty(value="积分兑换值")
    private Integer integral; // 积分兑换值

    @ApiModelProperty(value="变更时间")
    private Date updateDate; // 变更时间

    @ApiModelProperty(value="1-上架，2-下架")
    private Integer upDown; // 1-上架，2-下架

    @ApiModelProperty(value="上架时间")
    private Date upDate; // 上架时间

    @ApiModelProperty(value="下架时间")
    private Date downDate; // 下架时间

    @ApiModelProperty(value="用户收藏时间")
    private Date collectionDate;

    @ApiModelProperty(value="是否删除")
    private Integer isDel; //是否删除：1删除，0未删除

    @ApiModelProperty(value="排序权重")
    private Integer sortWeight;

    @ApiModelProperty(value="商品主图")
    private UploadImageResData mainImage;

    @ApiModelProperty(value="商品详情图[]")
    private List<UploadImageResData> detailImages;

    @ApiModelProperty(value="商品评论[]")
    private List<GoodsComment> goodsComments;

    @ApiModelProperty(value="当前用户是否收藏")
    private Boolean isCollection = false;

    @ApiModelProperty(value="是否为精选热卖商品")
    private Boolean isRecommend = false;

    @ApiModelProperty(value="是否为新品推荐商品")
    private Boolean isNew = false;

    @ApiModelProperty(value="是否为特惠专区商品")
    private Boolean isPreferential = false;

    @ApiModelProperty(value="普通商城Web地址")
    private String webUrl;

    @ApiModelProperty(value="普通商城分享地址")
    private String shareUrl;

    @ApiModelProperty(value="普通商城小程序路径")
    private String miniPage;

    @ApiModelProperty(value="积分商城Web地址")
    private String webUrl2;

    @ApiModelProperty(value="积分商城分享地址")
    private String shareUrl2;

    @ApiModelProperty(value="积分商城小程序路径")
    private String miniPage2;

    public String getMiniPage() {
        return ShareInfoEnum.SHARE_GOODS.getMiniPage() + this.uuId;
    }

    public String getMiniPage2() {
        if (this.isExchange == 0) return null;
        return ShareInfoEnum.SHARE_GOODS.getMiniPage2() + this.uuId;
    }

    @JsonIgnore
    public GoodsResData getThis() {
        return this;
    }

}
